package cn.caixiong.org.domain;

import cn.caixiong.basic.domain.BaseTreeNode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name="t_department")//指定表名
@ApiModel(description = "部门对象表")
public class Department extends BaseTreeNode<Department> {

    //部门编号
    //@NotBlank :这个字段不能为空
    @NotBlank(message = "部门编号不能为空")
    @ApiModelProperty(value = "部门编号",example = "726")
    private String sn;
    //名称
    @NotBlank(message = "部门名称不能为空")
    @ApiModelProperty(value = "部门名称")
    private String name;
    //状态 1：正常 0:禁用  //Integer默认值 null  int默认值 0 int是多少位的？32位
    @ApiModelProperty(value = "状态 1:正常 0:禁用")
    private Integer state;
    //部门经理id
    @Column(name = "manager_id")
    private Long managerId;
    //上级部门id
    @Column(name = "parent_id")
    private Long parentId;
    //先不管
    @Column(name = "dir_path")
    private String dirPath;
    //@Transient:临时的
    @Transient
    private String managerName;
    //
    @Transient
    private  String parentName;
    //上级部门结构数据
    @Transient
    private Long[] parentIds;
}
